public class SampleStatistics {
    public static void main(String[] args) {
        int[] minutes = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
        int[] frequencies = {59, 35, 20, 16, 18, 7, 13, 7, 4, 5, 0, 0};

        int totalSamples = 0;
        for (int freq : frequencies) {
            totalSamples += freq;
        }

        double sampleMean = 0.0;
        for (int i = 0; i < minutes.length; i++) {
            sampleMean += minutes[i] * frequencies[i];
        }
        sampleMean /= totalSamples;

        double sampleVariance = 0.0;
        for (int i = 0; i < minutes.length; i++) {
            sampleVariance += frequencies[i] * Math.pow(minutes[i] - sampleMean, 2);
        }
        sampleVariance /= totalSamples;

        double estimatedLambda = 1 / sampleMean;

        System.out.println("样本均值: " + sampleMean);
        System.out.println("样本方差: " + sampleVariance);
        System.out.println("估计的指数分布参数 lambda: " + estimatedLambda);
    }
}
